local qingbei = fk.CreateSkill {
  name = "wk_heg__qingbei",
}

Fk:loadTranslationTable{
  ["wk_heg__qingbei"] = "擎北",
  [":wk_heg__qingbei"] = "当你每回合首次使用牌时，你可摸两张牌，然后你本回合下次使用牌时弃置三张牌。",
  
  ["@@wk_heg__qingbei-turn"] = "擎北",

  ["$wk_heg__qingbei1"] = "待追上那司马懿，定教他没好果子吃！",
  ["$wk_heg__qingbei2"] = "身若不周，吾一人可作擎北之柱。",
}

qingbei:addEffect(fk.CardUsing, {
  anim_type = "special",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(qingbei.name) and player == target
     and #player.room.logic:getEventsOfScope(GameEvent.UseCard, 2, function (e)
        local use = e.data
        if use.from == player then
          return true
        end
      end, Player.HistoryTurn) == 1
  end,
  on_use = function(self, event, target, player, data)
    player:drawCards(2, qingbei.name)
    player.room:setPlayerMark(player, "@@wk_heg__qingbei-turn", 2)
  end,
})

qingbei:addEffect(fk.CardUsing, {
  anim_type = "special",
  is_delay_effect = true,
  can_trigger = function(self, event, target, player, data)
    return player:getMark("@@wk_heg__qingbei-turn") > 0 and player == target
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    if player:getMark("@@wk_heg__qingbei-turn") == 1 then
      player.room:askToDiscard(player, {
        min_num = 3,
        max_num = 3,
        include_equip = true,
        skill_name = qingbei.name,
        cancelable = false,
      })
    end
    player.room:addPlayerMark(player, "@@wk_heg__qingbei-turn", -1)
  end,
})

return qingbei